VLOG_OPTS = +libext+.v  \
	+libext+.sv  \
	$(SVERILOG_OPT) \
	+no_notifier  \
	+warn=noTMR  \
	+lint=all,noTMR,noVCDE,noIEELMME,noIWU,noZERO  \
	+v2k  \
	$(CMD_LINE) \
        +incdir+$(DES_DIR) \
	+incdir+$(TB_DIR) \
	-debug_pp \
        -notice \
        -R \

LIB_DIRS = -y $(DES_DIR)

HDL_FILES = \
        $(DES_DIR)/seg7_top.v \
        $(DES_DIR)/seg7_decode.v \
        $(TB_DIR)/$(TB_FILE) \

TST      = tb_seg7
DES_DIR  = ../../des/seg7
TB_DIR   = ../../verif/seg7_tb
TB_FILE  = tb_seg7.v
RUN      = run_vcs
VCS      := $(shell which vcs)

# Look to see if vcs is installed
ifeq ($(VCS),)
RUN = run_i
endif

tst :
	echo $(RUN)

run :
	make $(RUN)

run_vcs:
	vcs \
	$(VLOG_OPTS) \
        $(LIB_DIRS) \
        +vpdfile+$(TST).vpd \
        -l $(TST).log \
	$(TB_DIR)/$(TB_FILE) ;

run_i:
	iverilog -g2001 -DIVERILOG -I$(DES_DIR) -tvvp -Wall -Wno-timescale -DIVERILOG $(HDL_FILES)
	vvp a.out 

CLEAN:
	rm -rf csrc *.vpd *.vcd simv simv.daidir *.log .vcsmx_rebuild a.out
